package api

import (
	"github.com/labstack/echo/v4"
	"longmen/server/pkg/common/api_models"
	string2 "longmen/server/pkg/common/helper/string"
	"longmen/server/pkg/common/helper/util"
)

func (base *Controller) GetEplutusOrder(c echo.Context) error {

	r := &api_models.GetEplutusOrderReq{}
	if err := util.Json2Struct(c.Get("body").(string), r); err != nil {
		return util.BadParam(c, err)
	}
	r.Type = string2.GetDefaultNum(r.Type, 1)

	user, err := base.GetUserByCtx(c)
	if err != nil {
		return util.BuildLoginTimeOut(c, err)
	}

	result, msg, err := base.Service.GetEplutusOrder(r, user)
	if err != nil {
		return util.BuildFail(c, 1, msg, err)
	}
	return util.BuildSuccess(c, result, "")
}

func (base *Controller) GetVipPriceList(c echo.Context) error {

	resp, err := base.Service.GetVipPriceList()
	if err != nil {
		return util.BuildFail(c, 1, "", err)
	}
	return util.BuildSuccess(c, resp, "")
}
